<?php

require_once 'Pipes/FileSystem/File/Finder/AllProjects.php';
require_once 'PipesImpl/Config.php';

class PipesCore_Helpers_PublicFile
{
	private $_finder = '';
	private $_baseUri = '';

	public function __construct(PipesImpl_Config $config) {
		$this->_finder = new Pipes_FileSystem_File_Finder_AllProjects($config);
		$this->_baseUri = $config->base_uri;
	}

	public function factory($name) {
		$file = $this->_finder->find("Public/{$name}");
		return $this->_baseUri . str_replace('/Public', '', $file->file);
	}
}
